const { Sequelize, sequelize } = require('./sequelize');

const ExperimentTotalScore = sequelize.define('ExperimentTotalScore', {
  sId: {
    type: Sequelize.INTEGER,
    allowNull: false,
    unique: 'primaryKey',
    // references: {
    //   model: Student,
    //   key: 'sId',
    // },
  },
  cId: {
    type: Sequelize.INTEGER,
    allowNull: false,
    unique: 'primaryKey',
    // references: {
    //   model: ExperimentCourse,
    //   key: 'ecId',
    // },
  },
  totalScore: {
    type: Sequelize.INTEGER,
    // allowNull: false,
    validate: {
      min: {
        args: [[0]],
        msg: '分数最小为 0',
      },
      max: {
        args: [[100]],
        msg: '分数最大为 100',
      },
    },
  }
}, {
  modelName: 'ExperimentTotalScore',
  tableName: 'experiment_total_score',
  timestamps: false,
});

module.exports = {
  ExperimentTotalScore
};
